<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class salir extends CI_Controller {

    public function __construct() {
        parent::__construct();
        session_start();
    }

    public function index() {
        var_dump($_SESSION);
        $rol = $_SESSION['usuario']['rol'];
        $_SESSION = array();
        if (ini_get("session.use_cookies")) {
            $params = session_get_cookie_params();
            setcookie(session_name(), '', time() - 42000, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
        }
        session_destroy();

        if ($rol == "superadministrador") {
            header("location:admin");
        }
        header("location:entrar");
    }

}
